package com.invengo.module_check.ui.fragment.guide_listing;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.invengo.base.excel.ExportExcelUtils;
import com.invengo.module_check.BR;
import com.invengo.module_check.R;
import com.invengo.module_check.databinding.FragmentListingGuideBinding;

import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.utils.ToastUtils;

public class ListingGuideFragment extends BaseFragment<FragmentListingGuideBinding,ListingGuideViewModel> {
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_listing_guide;
    }

    @Override
    public String getRightTitle() {
        return "导出";
    }

    @Override
    public void onRightEvent(View view) {
        if (!viewModel.bookItemList.isEmpty()) {
            ExportExcelUtils.getInstance().exportListingGuide(getActivity(), viewModel.getMatchBooks());
        } else {
            ToastUtils.showShort("请先扫描书籍");
        }
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }
}
